//
//  HAODE
//
//  Created by panquanReabam.com on 15/9/23.
//  Copyright (c) 2015年 reabam.com. All rights reserved.
//

#import "ServiceDetailViewController.h"
#import "ZJSwitch.h"
#import "HAODEsingleton.h"
#import "UIViewExt.h"
#import "HttpRequest.h"
#import "JSONKit.h"
#import "UIImageView+WebCache.h"
#import "daogouview.h"
#import "RDVTabBarController.h"
#import "MJRefresh.h"
#import "huiyuanCell.h"
#import "huiyuandengjiViewController.h"
#import "shangpingview.h"
#import "peisongleibieViewController.h"
#import "ToResiduePayViewController.h"
#import "ServiceConfirmViewController.h"
#import "huiyuanDetailsViewController.h"
#import "MembershipDetailsViewController.h"
@interface ServiceDetailViewController ()<MBProgressHUDDelegate,UIGestureRecognizerDelegate,UINavigationControllerDelegate,UITextFieldDelegate,UITextViewDelegate,UISearchBarDelegate,UIScrollViewDelegate>
@property (strong, nonatomic) NSString *areaValue;
@property (strong, nonatomic) NSString*cityValue;
@property (strong, nonatomic) NSString*GuideCode;
@property (strong, nonatomic) NSString*memberId;
@property (strong, nonatomic) NSString*isEarnest;
@property(nonatomic,retain)UIDatePicker* da;
@end

@implementation ServiceDetailViewController

{
    UISearchBar *search;
    HAODEsingleton* commdity;
    UIButton* sxBtn;
    UIButton*jiantouBtn;
    UIButton*cardBtn;
    float lastContentOffset;
    UITextField*searchTextField;
    UITextField*zhekoujineTextFied;
    UITextField*songhuoTextFied;
    UITextField*anzhuangTextFied;
    UIButton*daogouname;
    UIView*view1;
    shangpingview*shangpingView;
    UIScrollView*mainScroll;
    UIScrollView*MYmainScroll;
    UILabel*huiyuanname;
    UIButton *tureBtn;
    UILabel*dingdanhao1;
    BOOL saveAccount;
    BOOL saveAccount1;
    BOOL isHaveDian;
    UIButton *xuanze;
    UIButton*jiagemingxi1;
    UIButton*DiscountRateSatBtn;
    NSMutableArray* arrrss;
    NSMutableArray*DiscountRatecode ;
    NSMutableArray*DiscountRatecontent ;
    ZJSwitch *switch2;
    UITextField*dinjinjineTextFied;
    UIButton*EarnestRateSatBtn;
    UILabel* weightke;
    UIView*view2;
    UIView*view3;
    UIView*view4;
    UIView*view5;
    UIView*view6;
    UITextView* tv;
    UILabel * label;
    UIImageView*imagess;
    UILabel*shengyuzhifujiage1;
    UIButton*anzhuangSatBtn;
    UIButton*peisongSatBtn;
    UIButton*jiantouBtn1;
    UIButton*jiantouBtn2;
    UIButton*jiantouBtn3;
    UIButton*jiantouBtn4;
    UIButton*jiantouBtn5;
    UIButton*jiantouBtn6;
    UIView* myToolBar;
    NSString*totalMoney;
    UILabel*youhuijine;
    UILabel*youhuiquanjine;
    UIButton*hejiMoney;
    UIView*beizhuView;
    UITextField*xianjinTextFied;
    UIView*diview;
    UIView*footerview;
    UIView*zuixiaview;
    UIButton*i1;
    UIButton*i12;
    UIButton*zhangkai;
    UIButton*zhangkai1;
    
    NSMutableArray*quantity;
}
@synthesize alt = alt;

-(void)BackAction:(UIButton *)sender{
    
    
    [self.navigationController popViewControllerAnimated:YES];
    
}
- (void)viewDidDisappear:(BOOL)animated

{
    
    [super viewDidDisappear:animated];
    
    
    
    self.navigationController.delegate = nil;
    
}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    [[self rdv_tabBarController] setTabBarHidden:YES];
    self.navigationController.navigationBarHidden=NO;
        self.navigationController.navigationBar.barStyle = UIBaselineAdjustmentNone;
    UILabel *lineLabel=[[UILabel alloc] initWithFrame:CGRectMake(0, 43,ScreenWidth, 1)];
    [lineLabel setBackgroundColor:[UIColor colorWithRed:238.0/255.0 green:238.0/255.0 blue:238.0/255.0 alpha:1.0]];
    [self.navigationController.navigationBar addSubview:lineLabel];
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
    [[UINavigationBar appearance] setBarTintColor:Color];
    
    UIImage* backImage = [UIImage imageNamed:@"fanhui"];
    CGRect backframe = CGRectMake(0,0,30,30);
    UIButton* backButton= [[UIButton alloc] initWithFrame:backframe];
    [backButton setBackgroundImage:backImage forState:UIControlStateNormal];
    backButton.titleLabel.textAlignment=NSTextAlignmentLeft;
    [backButton addTarget:self action:@selector(BackAction:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem* leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
    self.navigationItem.leftBarButtonItem = leftBarButtonItem;
    self.navigationController.delegate = self;
    
    self.navigationController.interactivePopGestureRecognizer.enabled = YES;
    self.navigationController.interactivePopGestureRecognizer.delegate = self;
    
    
    
//    
//}
//
//
//
//- (void)viewDidLoad
//{
//    
//    [super viewDidLoad];
    commdity=[HAODEsingleton shared];
    commdity.gengxin=@"";
    self.title=@"服务详情";
    
    
     saveAccount=NO;
    
    
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                                     [UIColor blackColor],
                                                                     UITextAttributeTextColor,
                                                                     [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1],
                                                                     UITextAttributeTextShadowColor,
                                                                     [NSValue valueWithUIOffset:UIOffsetMake(0, 0)],
                                                                     UITextAttributeTextShadowOffset,
                                                                     [UIFont fontWithName:@"Helvetica Neue" size:tetlefot],
                                                                     UITextAttributeFont,nil]];
    
    
    
    
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString* Token = [user objectForKey:@"tokenId"];
    if (Token ==nil) {
        Token=@"dd";
    }
    NSMutableDictionary *param = [NSMutableDictionary new];
    [param setValue:Token forKey:@"tokenId"];
    [param setValue:commdity.orderId forKey:@"serviceId"];
    
    
    [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
    
    
    [HttpRequest requestData:@"Business/Service/Detail" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
        if (isSuccess) {
            NSLog(@"-----------%@", severDataDict.dataDict);
            if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                [Global hideProgressHUDInternal:self.view];
                
                commdity.payStatuss= [[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"payStatus"];
                commdity.serviceStatuss= [[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"serviceStatus"];
                MYmainScroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0,64, ScreenWidth, ScreenHeight)];
                [MYmainScroll setBackgroundColor: zuiqianhuicolor];
                
                MYmainScroll.delegate = self;
                MYmainScroll.userInteractionEnabled = YES;
                MYmainScroll.scrollEnabled = YES;
                MYmainScroll.showsVerticalScrollIndicator = FALSE;
                MYmainScroll.showsHorizontalScrollIndicator = FALSE;
                [self.view addSubview:MYmainScroll];
                
                // 手势
                UITapGestureRecognizer *singleFingerOne = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeKeyBoad)];
                singleFingerOne.numberOfTouchesRequired = 1; //手指数
                singleFingerOne.numberOfTapsRequired = 1; //tap次数
                singleFingerOne.delegate = self;
                [MYmainScroll addGestureRecognizer:singleFingerOne];
                
                
                
                
                sxBtn = [[UIButton alloc] initWithFrame:CGRectMake(30, 0.0,  60/2, 60/2)];
                [sxBtn setBackgroundImage:[UIImage imageNamed:@"gengduodian"]  forState:UIControlStateNormal];
                [sxBtn addTarget:self action:@selector(xuanze:) forControlEvents:UIControlEventTouchUpInside];
                UIBarButtonItem* myBtnBtn = [[UIBarButtonItem alloc] initWithCustomView:sxBtn];
                self.navigationItem.rightBarButtonItem = myBtnBtn;

                
                view1=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 70)];
                view1.backgroundColor=[UIColor whiteColor];
                [MYmainScroll addSubview:view1];
                NSString *s12 = [NSString stringWithFormat:@"%@",   [[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"serviceNo"]];
                UIFont *font12 = [UIFont systemFontOfSize:17];
                CGSize size12 = CGSizeMake(320, 2000);
                CGSize labelsize12 = [s12 sizeWithFont:font12 constrainedToSize:size12 lineBreakMode:NSLineBreakByCharWrapping];
                UILabel*source=[[UILabel alloc]initWithFrame:CGRectMake(15, 32/2, labelsize12.width+11, 16)];
                source.text=[NSString stringWithFormat:@"%@",   [[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"serviceNo"]];
                source.textColor=[UIColor blackColor];
                source.font=[UIFont systemFontOfSize:17];
                [view1 addSubview:source];
                
                
                
                
                UILabel*deliveryStatus=[[UILabel alloc]initWithFrame:CGRectMake(source.right, 37/2, 60,Statusfot )];
        
                if ([[NSString stringWithFormat:@"%@",   [[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"serviceStatus"]] isEqualToString:@"A"]) {
                    deliveryStatus.textColor=luseColor;
                    deliveryStatus.text=[NSString stringWithFormat:@"%@",  @"服务申请"];
                }if ([[NSString stringWithFormat:@"%@",   [[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"serviceStatus"]] isEqualToString:@"R"]) {
                    deliveryStatus.textColor=luseColor;
                    deliveryStatus.text=[NSString stringWithFormat:@"%@",  @"服务登记"];
                }
                if ([[NSString stringWithFormat:@"%@",   [[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"serviceStatus"]] isEqualToString:@"C"]) {
                    deliveryStatus.textColor=luseColor;
                    deliveryStatus.text=[NSString stringWithFormat:@"%@",  @"服务确认"];
                }
                
                if ([[NSString stringWithFormat:@"%@",   [[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"serviceStatus"]] isEqualToString:@"N"]) {
                    deliveryStatus.textColor=huisecolor;
                    deliveryStatus.text=[NSString stringWithFormat:@"%@",  @"已取消"];
                }
                
                deliveryStatus.font=[UIFont systemFontOfSize:Statusfot];
                [view1 addSubview:deliveryStatus];
                
                
                UILabel*orderStatus=[[UILabel alloc]initWithFrame:CGRectMake(deliveryStatus.right, 37/2, 140, Statusfot)];
//                orderStatus.textAlignment=NSTextAlignmentCenter;
                
                orderStatus.textColor=shenhongsecolor;
                orderStatus.text=[NSString stringWithFormat:@"%@",   [[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"serviceTypeName"]];
                
                //                if ([[NSString stringWithFormat:@"%@",   [[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"serviceType"]] isEqualToString:@"F"]) {
                //                    orderStatus.textColor=shenhongsecolor;
                //                    orderStatus.text=[NSString stringWithFormat:@"%@",  @"安装"];
                //                }if ([[NSString stringWithFormat:@"%@",   [[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"serviceType"]] isEqualToString:@"S"]) {
                //                    orderStatus.textColor=shenhongsecolor;
                //                    orderStatus.text=[NSString stringWithFormat:@"%@",  @"维修"];
                //                }
                //                if ([[NSString stringWithFormat:@"%@",   [[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"serviceType"]] isEqualToString:@"O"]) {
                //                    orderStatus.textColor=shenhongsecolor;
                //                    orderStatus.text=[NSString stringWithFormat:@"%@",  @"其他"];
                //                }
                
                orderStatus.font=[UIFont systemFontOfSize:Statusfot];
                [view1 addSubview:orderStatus];

                
                UILabel* duogou=[[UILabel alloc]initWithFrame:CGRectMake(15, 85/2, 33, 15)];
                duogou.text=[NSString stringWithFormat:@"来源"];
                duogou.textColor=zhonghuiColor;
                duogou.font=[UIFont systemFontOfSize:contenfot];
                [view1 addSubview:duogou];
                
                NSString *s1 = [NSString stringWithFormat:@"%@",   [[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"source"]];
                UIFont *font1 = [UIFont systemFontOfSize:contenfot];
                CGSize size1 = CGSizeMake(320, 2000);
                CGSize labelsize1 = [s1 sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
                
                daogouname=[[UIButton alloc]initWithFrame:CGRectMake(duogou.right,  85/2,labelsize1.width+15,15)];
                [daogouname setTitle:[NSString stringWithFormat:@"%@",   [[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"source"]] forState:UIControlStateNormal];
                daogouname.titleLabel.font=[UIFont systemFontOfSize:contenfot];
                daogouname.titleLabel.textAlignment=NSTextAlignmentLeft;
                daogouname.contentHorizontalAlignment = UIControlContentHorizontalAlignmentFill;
                [daogouname setTitleColor:shenhuicolor forState:UIControlStateNormal];
                [view1 addSubview:daogouname];
                
                
                UILabel* orderDate=[[UILabel alloc]initWithFrame:CGRectMake(daogouname.right, 85/2, 65, 15)];
                orderDate.text=@"下单日期";
                orderDate.textColor=zhonghuiColor;
                orderDate.font=[UIFont systemFontOfSize:contenfot];
//                [view1 addSubview:orderDate];
                NSRange range={0,10};
                NSString* string =[[[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"serviceDate"] substringWithRange:range];
                UILabel* orderDate1=[[UILabel alloc]initWithFrame:CGRectMake(daogouname.right, 85/2, 180, 15)];
                orderDate1.text=[NSString stringWithFormat:@"%@",  string];
                orderDate1.textColor=shenhuicolor;
                orderDate1.font=[UIFont systemFontOfSize:contenfot];
                [view1 addSubview:orderDate1];
                UILabel *line911=[[UILabel alloc] initWithFrame:CGRectMake(0, 70, ScreenWidth, 0.35)];
                line911.backgroundColor=qianhuicolor;
                [view1 addSubview:line911];
                UILabel *line91=[[UILabel alloc] initWithFrame:CGRectMake(0, 80, ScreenWidth, 0.35)];
                line91.backgroundColor=qianhuicolor;
                [view1 addSubview:line91];
                
                
                
                
                
                
                
                view2=[[UIView alloc]initWithFrame:CGRectMake(0, view1.bottom+10, ScreenWidth, 250/2)];
                view2.backgroundColor=[UIColor whiteColor];
                [MYmainScroll addSubview:view2];
                
                UILabel *line1=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 0.35)];
                line1.backgroundColor=qianhuicolor;
                [view2 addSubview:line1];
                UILabel *line18=[[UILabel alloc] initWithFrame:CGRectMake(0, 250/2-0.35, ScreenWidth, 0.35)];
                line18.backgroundColor=qianhuicolor;
                [view2 addSubview:line18];
                UIImageView *_xianview = [[UIImageView alloc]initWithFrame:CGRectMake(10,50-0.5, ScreenWidth-20, 0.5)];
                _xianview.image=[UIImage imageNamed:@"hengxian"];
                
                [view2 addSubview:_xianview];
                
                NSString *s = [NSString stringWithFormat:@"%@ ( %@ )",   [[severDataDict.dataDict objectForKey:@"member"] objectForKey:@"memberName"],   [[severDataDict.dataDict objectForKey:@"member"] objectForKey:@"phone"]];
                
                UIFont *font = [UIFont systemFontOfSize:16];
                CGSize size = CGSizeMake(320, 2000);
                CGSize labelsize = [s sizeWithFont:font constrainedToSize:size lineBreakMode:NSLineBreakByCharWrapping];
                huiyuanname=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, labelsize.width+3, 50)];
                huiyuanname.text=[NSString stringWithFormat:@"%@ ( %@ )",   [[severDataDict.dataDict objectForKey:@"member"] objectForKey:@"memberName"],   [[severDataDict.dataDict objectForKey:@"member"] objectForKey:@"phone"]];
                huiyuanname.textColor=[UIColor blackColor];
                huiyuanname.font=[UIFont systemFontOfSize:16];
                [view2 addSubview:huiyuanname];
                
                UIImageView*Seximage=[[UIImageView alloc]initWithFrame:CGRectMake(huiyuanname.right, 15, 20, 20)];
                if (![[[severDataDict.dataDict objectForKey:@"member"] objectForKey:@"sex"] isEqual:[NSNull null]]) {
                    
                    if ([[[severDataDict.dataDict objectForKey:@"member"] objectForKey:@"sex"]isEqualToString:@"男"]) {
                        Seximage.image=[UIImage imageNamed:@"nan"];
                        
                        
                    }else{
                        Seximage.image=[UIImage imageNamed:@"nv"];
                    }
                    
                    
                }else{
                    Seximage.image=[UIImage imageNamed:@"nv"];
                    
                    
                }
                
                [view2 addSubview:Seximage];
                
                
                UILabel*jifen=[[UILabel alloc]init];
                jifen.text=[NSString stringWithFormat:@"%@", @"等级"];
                jifen.font=[UIFont systemFontOfSize:contenfot];
                jifen.textColor=zhonghuiColor;
                jifen.frame=CGRectMake(Seximage.right+10, 0, ScreenWidth*65/750, 50);
                [view2 addSubview:jifen];
                //
                
                commdity.memberId= [[severDataDict.dataDict objectForKey:@"member"] objectForKey:@"memberId"];
                
                
                UIButton*jiantou = [[UIButton alloc]init];
                jiantou.frame = CGRectMake(ScreenWidth-30,18,8, 13);
                [jiantou setImage:[UIImage imageNamed:@"xiangzuo-.png"] forState:UIControlStateNormal];
                [jiantou addTarget:self action:@selector(edithuiyuan:) forControlEvents:UIControlEventTouchUpInside];
                [view2 addSubview:jiantou];
                UIButton*jiadajiantou = [[UIButton alloc]init];
                jiadajiantou.frame = CGRectMake(ScreenWidth-100,0,100, 44);
                [jiadajiantou addTarget:self action:@selector(edithuiyuan:) forControlEvents:UIControlEventTouchUpInside];
                [view2 addSubview:jiadajiantou];
                
                
                UILabel*shouhuoren=[[UILabel alloc]init];
                shouhuoren.text=[NSString stringWithFormat:@"%@", @"收货人"];
                shouhuoren.font=[UIFont systemFontOfSize:contenfot];
                shouhuoren.textColor=zhonghuiColor;
                shouhuoren.frame=CGRectMake(15, _xianview.bottom+14,45,contenfot);
                [view2 addSubview:shouhuoren];
                
                
                NSString *ss = [[severDataDict.dataDict objectForKey:@"send"] objectForKey:@"consignee"];
                UIFont *fonts = [UIFont systemFontOfSize:contenfot];
                CGSize sizes = CGSizeMake(320, 2000);
                CGSize labelsizes = [ss sizeWithFont:fonts constrainedToSize:sizes lineBreakMode:NSLineBreakByCharWrapping];
                
                UILabel*shouhuorenName=[[UILabel alloc]init];
                shouhuorenName.frame=CGRectMake(shouhuoren.right,  _xianview.bottom+14, labelsizes.width, contenfot);
                shouhuorenName.text= [[severDataDict.dataDict objectForKey:@"send"] objectForKey:@"consignee"];
                shouhuorenName.font=[UIFont systemFontOfSize:contenfot];
                shouhuorenName.textColor=shenhuicolor;
                [view2 addSubview:shouhuorenName];
                
                UILabel*tel=[[UILabel alloc]init];
                
                tel.text=[NSString stringWithFormat:@"%@", @"电话"];
                tel.font=[UIFont systemFontOfSize:contenfot];
                tel.textColor=zhonghuiColor;
                tel.frame=CGRectMake(shouhuorenName.right+15, _xianview.bottom+14, 32.5, contenfot);
                [view2 addSubview:tel];
                //
                UILabel*telnumber=[[UILabel alloc]init];
                telnumber.text=[[severDataDict.dataDict objectForKey:@"send"] objectForKey:@"phone"];
                telnumber.font=[UIFont systemFontOfSize:contenfot];
                telnumber.textColor=shenhuicolor;
                telnumber.frame=CGRectMake(tel.right,  _xianview.bottom+14, ScreenWidth*250/750, contenfot);
                [view2 addSubview:telnumber];
                
                
                
                NSString*address= [[severDataDict.dataDict objectForKey:@"send"] objectForKey:@"address"];
                
                NSString *addresStr =[NSString stringWithFormat:@"收货地址 %@",  address];
                UIFont *addressf = [UIFont systemFontOfSize:contenfot];
                CGSize sizeAddress = CGSizeMake(ScreenWidth-60, 2000);
                CGSize labelsizeAddress = [addresStr sizeWithFont:addressf constrainedToSize:sizeAddress lineBreakMode:NSLineBreakByCharWrapping];
                
                
                huiyuanname=[[UILabel alloc]initWithFrame:CGRectMake(15, shouhuoren.bottom+5, ScreenWidth-60, labelsizeAddress.height)];
                huiyuanname.text=[NSString stringWithFormat:@"收货地址 %@",  address];
                huiyuanname.textColor=shenhuicolor;
                huiyuanname.numberOfLines=2;
                huiyuanname.font=[UIFont systemFontOfSize:contenfot];
                
                NSMutableAttributedString *AttributedSt = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"收货地址 %@",  address]];
                
                [AttributedSt addAttribute:NSFontAttributeName
                 
                                     value:[UIFont systemFontOfSize:contenfot]
                 
                                     range:NSMakeRange(0, 4)];
                
                [AttributedSt addAttribute:NSForegroundColorAttributeName
                 
                                     value:zhonghuiColor
                 
                                     range:NSMakeRange(0, 4)];
                
                
                huiyuanname.attributedText = AttributedSt;
                
                [view2 addSubview:huiyuanname];

                
                
                
                
                
                
                view3=[[UIView alloc]initWithFrame:CGRectMake(0, view2.bottom+10, ScreenWidth, 45)];
                view3.backgroundColor=[UIColor whiteColor];
                [MYmainScroll addSubview:view3];
                UILabel *line=[[UILabel alloc] initWithFrame:CGRectMake(0,0, ScreenWidth, 0.35)];
                line.backgroundColor=qianhuicolor;
                [view3 addSubview:line];
                
                quantity=[[NSMutableArray alloc]init];
                totalMoney= [[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"totalMoney"];
                NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
                [numberFormatter setPositiveFormat:@"###,##0.00;"];
                NSString *formattedNumberString = [numberFormatter stringFromNumber:[NSNumber numberWithDouble:totalMoney.doubleValue]];
                
                arrrss=[severDataDict.dataDict objectForKey:@"orderItem"];
                
                
                if (arrrss.count>0) {
                    
                    for (NSDictionary* dicc in arrrss )
                    {
                        
                        [quantity addObject:[dicc valueForKey:@"quantity"]];
                        
                    }}
                
                NSNumber *sum11 = [quantity valueForKeyPath:@"@sum.floatValue"];
                weightke=[[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-250, 0, 230, 45)];
                weightke.text=[NSString  stringWithFormat:@"共 %@ 件,   ￥%@",sum11, formattedNumberString];
                weightke.textColor = [UIColor colorWithRed:5.00/255.0 green:18.0/255.0 blue:40.00/255.0 alpha:1];
                weightke.textAlignment = NSTextAlignmentRight;
                weightke.font = [UIFont systemFontOfSize:16];
                
                
                
                NSMutableAttributedString *AttributedStr2 = [[NSMutableAttributedString alloc]initWithString:[NSString  stringWithFormat:@"共 %@ 件,   ￥%@",sum11, formattedNumberString]];
                [AttributedStr2 addAttribute:NSFontAttributeName
                 
                                       value:[UIFont systemFontOfSize:13.0]
                 
                                       range:NSMakeRange(0, 8)];
                
                [AttributedStr2 addAttribute:NSForegroundColorAttributeName
                 
                                       value:zhonghuiColor
                 
                                       range:NSMakeRange(0, 8)];
                
                
                weightke.attributedText = AttributedStr2;
                [view3 addSubview:weightke];
                
                
                
                
                UILabel*shangpingxinxi=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, 80, 45)];
                shangpingxinxi.text=@"商品信息";
                shangpingxinxi.textColor=[UIColor blackColor];
                shangpingxinxi.font=[UIFont systemFontOfSize:15];
                [view3 addSubview:shangpingxinxi];
                
                UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(15, 45-0.35, ScreenWidth-30, 0.35)];
                lineLabel1.backgroundColor=qianhuicolor;
                [view3 addSubview:lineLabel1];

                
               
                
                
                
                arrrss=[severDataDict.dataDict objectForKey:@"orderItem"];
                
                NSLog(@"%@",arrrss);
                if (arrrss.count>0) {
                    
                    for (int i = 0; i<arrrss.count; i++) {
                        
                        shangpingView = [[shangpingview alloc]initWithFrame:CGRectMake(0, view3.bottom+(120*i), ScreenWidth, 120)];
                        shangpingView.backgroundColor=[UIColor whiteColor];
                        [shangpingView.headImageFull setImageWithURL:[[arrrss objectAtIndex:i] objectForKey:@"headImageFull"] placeholderImage:[UIImage imageNamed:@""]];
                        [shangpingView.headImageFull.layer setCornerRadius:5.0];
                        [shangpingView.headImageFull.layer setBorderWidth:0.3];
                        [shangpingView.headImageFull.layer setMasksToBounds:YES];
                        CGColorSpaceRef colorSpace2 = CGColorSpaceCreateDeviceRGB();
                        CGColorRef colorref2 = CGColorCreate(colorSpace2,(CGFloat[]){ 0, 0, 0, 0.3 });
                        [shangpingView.headImageFull.layer setBorderColor:colorref2];//边框颜色
                       shangpingView.itemName.text=[NSString stringWithFormat:@"%@%@",[[arrrss objectAtIndex:i] objectForKey:@"itemCode"],[[arrrss objectAtIndex:i] objectForKey:@"itemName"]];
                        shangpingView.quantity.text=[NSString stringWithFormat:@"数量 %@",[[arrrss objectAtIndex:i] objectForKey:@"thisQty"]];
                        NSString*dealPrice=[NSString stringWithFormat:@"%@",[[arrrss objectAtIndex:i] objectForKey:@"dealPrice"]];
                        
                        NSNumberFormatter *numberFormatte = [[NSNumberFormatter alloc] init];
                        [numberFormatte setPositiveFormat:@"###,##0.00;"];
                        NSString *formattedNumberString5 = [numberFormatte stringFromNumber:[NSNumber numberWithDouble:dealPrice.doubleValue]];
                        
                        shangpingView.dealPrice.text=[NSString stringWithFormat:@"¥ %@",formattedNumberString5];

                        shangpingView.dealPrice.textColor=hongsecolor;
                        shangpingView.itemType.text=[NSString stringWithFormat:@"%@",[[arrrss objectAtIndex:i] objectForKey:@"specName"]];
                        
                        
                        if (i==arrrss.count-1) {
                            UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(0, 120-0.35, ScreenWidth, 0.35)];
                            lineLabel1.backgroundColor=qianhuicolor;
                            [shangpingView addSubview:lineLabel1];
                        }else{
                            UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(15, 120-0.35, ScreenWidth-30, 0.35)];
                            lineLabel1.backgroundColor=qianhuicolor;
                            [shangpingView addSubview:lineLabel1];

                        
                        }
                        
                        [MYmainScroll addSubview:shangpingView];
                    }
                    
                     view4=[[UIView alloc]initWithFrame:CGRectMake(0, shangpingView.bottom+10, ScreenWidth, 90)];
                    
                }else{
                
                
                 view4=[[UIView alloc]initWithFrame:CGRectMake(0, view3.bottom+10, ScreenWidth, 90)];
                
                }
        
                
                //shoukuan
                
               
                
                
               
                view4.layer.borderColor = LineColor.CGColor;
                [view4.layer setBorderWidth:0.35];   //边
                view4.backgroundColor=[UIColor whiteColor];
                [MYmainScroll addSubview:view4];
                UILabel *lineL=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 0.35)];
                lineL.backgroundColor=qianhuicolor;
                [view4 addSubview:lineL];
                
                
                UILabel*shoukuanxinxi=[[UILabel alloc]initWithFrame:CGRectMake(15, 19, 80, 15)];
                shoukuanxinxi.text=@"登记信息";
                shoukuanxinxi.textColor=shenhuicolor;
                shoukuanxinxi.font=[UIFont systemFontOfSize:15];
                [view4 addSubview:shoukuanxinxi];
                
                
                UILabel*shihui=[[UILabel alloc]initWithFrame:CGRectMake(15, shoukuanxinxi.bottom+13, 33, 14)];
                shihui.text=@"来源";
                shihui.textColor=shenhuicolor;
                shihui.font=[UIFont systemFontOfSize:14];
                [view4 addSubview:shihui];
                NSRange range1={0,10};
                NSString* string1 =[[[severDataDict.dataDict objectForKey:@"predict"] objectForKey:@"predictDate"] substringWithRange:range1];
                UILabel*shihuiduoshao=[[UILabel alloc]initWithFrame:CGRectMake(shihui.right, shoukuanxinxi.bottom+13, 250, 14)];
                shihuiduoshao.text=[NSString stringWithFormat:@"%@   %@",   [[severDataDict.dataDict objectForKey:@"predict"] objectForKey:@"predictName"],   string1];
                shihuiduoshao.textColor=shenhuicolor;
                shihuiduoshao.font=[UIFont systemFontOfSize:14];
                [view4 addSubview:shihuiduoshao];
                
                NSNumber*Total = [[severDataDict.dataDict objectForKey:@"predict"] objectForKey:@"predictMoney"];
                totalMoney = [[severDataDict.dataDict objectForKey:@"predict"] objectForKey:@"predictMoney"];
                NSNumberFormatter *numberFormatter2 = [[NSNumberFormatter alloc] init];
                [numberFormatter setPositiveFormat:@"###,##0.00;"];
                NSString *formattedNumberString2 = [numberFormatter2 stringFromNumber:[NSNumber numberWithDouble:Total.doubleValue]];
                
                NSString *ss1 =[NSString stringWithFormat:@"收费金额 ¥%@",   formattedNumberString2];
                
                UIFont *font1ss = [UIFont systemFontOfSize:14];
                CGSize size1ss = CGSizeMake(ScreenWidth-60, 2000);
                CGSize labelsize1ss = [ss1 sizeWithFont:font1ss constrainedToSize:size1ss lineBreakMode:NSLineBreakByCharWrapping];
                
                UILabel*shihuiduoshao1=[[UILabel alloc]initWithFrame:CGRectMake(15, shihui.bottom+7, labelsize1ss.width+5, 14)];
                shihuiduoshao1.text=[NSString stringWithFormat:@"收费金额 ¥%@",   formattedNumberString2];
                shihuiduoshao1.textColor=shenhuicolor;
                shihuiduoshao1.font=[UIFont systemFontOfSize:contenfot];
                [view4 addSubview:shihuiduoshao1];
                
                
                UILabel*sat=[[UILabel alloc]initWithFrame:CGRectMake(shihuiduoshao1.right, shihui.bottom+7, 160, 14)];
                if ([[[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"payStatus"]isEqualToString:@"N"]) {
                    sat.text=@"未支付";
                    sat.textColor=hongsecolor;
                }else {
                    sat.text=@"已支付";
                    sat.textColor=luseColor;
                
                
                }
                
                sat.font=[UIFont systemFontOfSize:14];
                [view4 addSubview:sat];
                
                
                
               zhangkai=[[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth-97, shihui.bottom+7, 80, 12)];
                [zhangkai setTitle:@"展开更多" forState:UIControlStateNormal];
                [zhangkai setTitleColor:zhonghuiColor forState:UIControlStateNormal];
                [zhangkai addTarget:self action:@selector(zhankai:) forControlEvents:UIControlEventTouchUpInside];
                zhangkai.titleLabel.font=[UIFont systemFontOfSize:12];
                zhangkai.contentHorizontalAlignment=UIControlContentHorizontalAlignmentRight;
                [view4 addSubview:zhangkai];
                
                commdity.Memo=[NSString stringWithFormat:@"%@",[[severDataDict.dataDict objectForKey:@"predict"] objectForKey:@"predictDesc"]];
                
      
                UILabel*beizhu=[[UILabel alloc]initWithFrame:CGRectMake(15,90+15, ScreenWidth*70/750, 15)];
                beizhu.text=@"说明";
                beizhu.font= [UIFont systemFontOfSize:15];
                [beizhu setTextColor:qianheicolor];
                [view4 addSubview:beizhu];
                
                if ([commdity.Memo length]>1) {
                    
                    
                    NSString *s1 =[NSString stringWithFormat:@"%@", commdity.Memo];
                    UIFont *font1 = [UIFont systemFontOfSize:contenfot];
                    CGSize size1 = CGSizeMake(ScreenWidth-60, 2000);
                    CGSize labelsize1 = [s1 sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
                    
                    UILabel*beizhu1=[[UILabel alloc]initWithFrame:CGRectMake(15, beizhu.bottom+12, ScreenWidth-40, labelsize1.height+30)];
                    beizhu1.text=s1;
                    beizhu1.numberOfLines=0;
                    beizhu1.font= [UIFont systemFontOfSize:contenfot];
                    [beizhu1 setTextColor:shenhuicolor];
                    [view4 addSubview:beizhu1];
                    
                    
                    
                }else{
                   
                    
                    [view4 addSubview:beizhu];
                    
                }


                
                
                
                
                
                
                
                diview=[[UIView alloc]initWithFrame:CGRectMake(0, view4.bottom+10, ScreenWidth, 100)];
               
                diview.backgroundColor=zuiqianhuicolor;
                [MYmainScroll addSubview:diview];
                
                
                
                
            if ([[[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"serviceStatus"] isEqualToString:@"C"]) {
                
                 diview.backgroundColor=[UIColor whiteColor];
                diview.layer.borderColor = LineColor.CGColor;
                [diview.layer setBorderWidth:0.35];   //边
               
//                UIView*diview1=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 10)];
//                diview1.backgroundColor=zuiqianhuicolor;
//                [diview addSubview:diview1];
                
                UILabel*querenxinxi=[[UILabel alloc]initWithFrame:CGRectMake(15, 15+10, 80, 15)];
                querenxinxi.text=@"确认信息";
                querenxinxi.textColor=shenhuicolor;
                querenxinxi.font=[UIFont systemFontOfSize:15];
                [diview addSubview:querenxinxi];
                
                
                UILabel*laiyuan=[[UILabel alloc]initWithFrame:CGRectMake(15, querenxinxi.bottom+13, 35, 14)];
                laiyuan.text=@"来源";
                laiyuan.textColor=shenhuicolor;
                laiyuan.font=[UIFont systemFontOfSize:14];
                [diview addSubview:laiyuan];
                 NSString* string1 =[[[severDataDict.dataDict objectForKey:@"confirm"] objectForKey:@"confirmDate"] substringWithRange:range1];
                UILabel*laiyuanduoshao=[[UILabel alloc]initWithFrame:CGRectMake(shihui.right, querenxinxi.bottom+13, 250, 14)];
                laiyuanduoshao.text=[NSString stringWithFormat:@"%@ %@",   [[severDataDict.dataDict objectForKey:@"confirm"] objectForKey:@"confirmName"],   string1];
                laiyuanduoshao.textColor=shenhuicolor;
                laiyuanduoshao.font=[UIFont systemFontOfSize:14];
                [diview addSubview:laiyuanduoshao];
                
                NSNumber*Total1 = [[severDataDict.dataDict objectForKey:@"confirm"] objectForKey:@"confirmMoney"];
                
                NSNumberFormatter *numberFormatter1 = [[NSNumberFormatter alloc] init];
                [numberFormatter1 setPositiveFormat:@"###,##0.00;"];
                NSString *formattedNumberString1 = [numberFormatter1 stringFromNumber:[NSNumber numberWithDouble:Total1.doubleValue]];
                
                NSString *ss1 =[NSString stringWithFormat:@"收费金额 ¥ %@",   formattedNumberString1];
                
                UIFont *font1ss1 = [UIFont systemFontOfSize:contenfot];
                CGSize size1ss1 = CGSizeMake(ScreenWidth-60, 2000);
                CGSize labelsize1ss1 = [ss1 sizeWithFont:font1ss1 constrainedToSize:size1ss1 lineBreakMode:NSLineBreakByCharWrapping];
                
                UILabel*jin=[[UILabel alloc]initWithFrame:CGRectMake(15, laiyuan.bottom+7, labelsize1ss1.width+10, 14)];
                jin.text=[NSString stringWithFormat:@"收费金额 ¥ %@",   formattedNumberString1];
                jin.textColor=shenhuicolor;
                jin.font=[UIFont systemFontOfSize:14];
                [diview addSubview:jin];
                
                
                UILabel*sats=[[UILabel alloc]initWithFrame:CGRectMake(jin.right, laiyuan.bottom+7, 160, 14)];
                if ([[[severDataDict.dataDict objectForKey:@"service"] objectForKey:@"payStatus"]isEqualToString:@"N"]) {
                    sats.text=@"未支付";
                    sats.textColor=hongsecolor;
                }else {
                    sats.text=@"已支付";
                    sats.textColor=luseColor;
                    
                    
                }
                
                sats.font=[UIFont systemFontOfSize:14];
                [diview addSubview:sats];
                
                
                zhangkai1=[[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth-97, laiyuan.bottom+7, 80, 12)];
                [zhangkai1 setTitle:@"展开更多" forState:UIControlStateNormal];
                [zhangkai1 setTitleColor:zhonghuiColor forState:UIControlStateNormal];
                [zhangkai1 addTarget:self action:@selector(zhankai1:) forControlEvents:UIControlEventTouchUpInside];
                zhangkai1.titleLabel.font=[UIFont systemFontOfSize:12];
                zhangkai1.contentHorizontalAlignment=UIControlContentHorizontalAlignmentRight;
                [diview addSubview:zhangkai1];
                
                commdity.how=[NSString stringWithFormat:@"%@",[[severDataDict.dataDict objectForKey:@"confirm"] objectForKey:@"confirmDesc"]];
                
           
                UILabel*beizhu1=[[UILabel alloc]initWithFrame:CGRectMake(15,95+15, ScreenWidth*70/750, 15)];
                beizhu1.text=@"说明";
                beizhu1.font= [UIFont systemFontOfSize:15];
                [beizhu1 setTextColor:qianheicolor];
                [diview addSubview:beizhu1];
                
                if ([commdity.how length]>1) {
                    
                    
                    NSString *s1 =[NSString stringWithFormat:@"%@", commdity.how];
                    UIFont *font1 = [UIFont systemFontOfSize:contenfot];
                    CGSize size1 = CGSizeMake(ScreenWidth-60, 2000);
                    CGSize labelsize1 = [s1 sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
                    
                    UILabel*beizhu2=[[UILabel alloc]initWithFrame:CGRectMake(15, beizhu1.bottom+12, ScreenWidth-40, labelsize1.height+30)];
                    beizhu2.text=s1;
                    beizhu2.numberOfLines=0;
                    beizhu2.font= [UIFont systemFontOfSize:contenfot];
                    [beizhu2 setTextColor:shenhuicolor];
                    [diview addSubview:beizhu2];
                    
                    
                    
                }else{
                    
                    
                    [diview addSubview:beizhu1];
                    
                }
                
                zuixiaview=[[UIView alloc]initWithFrame:CGRectMake(0, diview.bottom, ScreenWidth, 150)];
                zuixiaview.backgroundColor=zuiqianhuicolor;
                [MYmainScroll addSubview:zuixiaview];
                
                NSNumber*confirmMoney = [[severDataDict.dataDict objectForKey:@"confirm"] objectForKey:@"confirmMoney"];
                
                NSNumberFormatter *numberFormatte = [[NSNumberFormatter alloc] init];
                [numberFormatte setPositiveFormat:@"###,##0.00;"];
                NSString *formattedNumberString5 = [numberFormatte stringFromNumber:[NSNumber numberWithDouble:confirmMoney.doubleValue]];
                
                UILabel*jine=[[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-200, 18, 183, 45)];
                jine.text=[NSString stringWithFormat:@"服务金额 ¥ %@",   formattedNumberString5];
                jine.textColor=[UIColor blackColor];
                jine.font=[UIFont systemFontOfSize:24];
                NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"服务金额 ¥ %@",   formattedNumberString5]];
                [AttributedStr addAttribute:NSFontAttributeName
                 
                                      value:[UIFont systemFontOfSize:15.0]
                 
                                      range:NSMakeRange(0, 6)];
                
                [AttributedStr addAttribute:NSForegroundColorAttributeName
                 
                                      value:shenhuicolor
                 
                                      range:NSMakeRange(0,6)];
                
                
                jine.attributedText = AttributedStr;
                
                jine.textAlignment=NSTextAlignmentRight;
                [zuixiaview addSubview:jine];
 
                
                
            }else{
               
                zuixiaview=[[UIView alloc]initWithFrame:CGRectMake(0, view4.bottom, ScreenWidth, 150)];
                zuixiaview.backgroundColor=zuiqianhuicolor;
                [MYmainScroll addSubview:zuixiaview];
                
                NSNumber*confirmMoney = [[severDataDict.dataDict objectForKey:@"confirm"] objectForKey:@"confirmMoney"];
                
                NSNumberFormatter *numberFormatte = [[NSNumberFormatter alloc] init];
                [numberFormatte setPositiveFormat:@"###,##0.00;"];
                NSString *formattedNumberString5 = [numberFormatte stringFromNumber:[NSNumber numberWithDouble:confirmMoney.doubleValue]];
                
                UILabel*jine=[[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-200, 18, 183, 45)];
                jine.text=[NSString stringWithFormat:@"服务金额 ¥ %@",   formattedNumberString5];
                jine.textColor=[UIColor blackColor];
                jine.font=[UIFont systemFontOfSize:24];
            NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"服务金额 ¥ %@",   formattedNumberString5]];
                [AttributedStr addAttribute:NSFontAttributeName
                 
                                      value:[UIFont systemFontOfSize:15.0]
                 
                                      range:NSMakeRange(0, 6)];
                
                [AttributedStr addAttribute:NSForegroundColorAttributeName
                 
                                      value:shenhuicolor
                 
                                      range:NSMakeRange(0,6)];
                
                
                jine.attributedText = AttributedStr;
                
                jine.textAlignment=NSTextAlignmentRight;
                [zuixiaview addSubview:jine];

            
            }
            
             
                
                
                [MYmainScroll setContentSize:CGSizeMake(ScreenWidth, zuixiaview.bottom+50)];
            }else{
                [Global hideProgressHUDInternal:self.view];
                NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                [Global showTextHudSub:requestResultStr view:self.view];
            }
            
        }
        else
        {
            [Global hideProgressHUDInternal:self.view];
            NSLog(@"aaaaaaaa%@",severDataDict.dataDict);
            [Global showTextHudSub:@"连接失败" view:self.view];
        }
        
    }];
    
    
    
}
-(void)edithuiyuan:(UIButton*)sender{
    commdity.gengxin=@"";
    MembershipDetailsViewController *detailViewController = [[MembershipDetailsViewController alloc] init];
    
    [self.navigationController pushViewController:detailViewController animated:YES];
    
   
}

-(void)xuanze:(UIButton*)sender{
    
    [i12 removeFromSuperview];
   
    [i1 removeFromSuperview];
    if ( !saveAccount) {
         saveAccount=YES;
    
    
    
    
    i1=[[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth-168, 0,168/2, 220*ScreenHeight/1334)];
    i1.backgroundColor=[UIColor colorWithRed:90/255.0 green:150/255.0 blue:26/255.0 alpha:1.0];
    [i1 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    i1.titleLabel.font=[UIFont systemFontOfSize:contenfot];
    [i1 addTarget:self action:@selector(bushouyin:) forControlEvents:UIControlEventTouchUpInside];
    [i1 setTitle:@"收银" forState:UIControlStateNormal];
    [MYmainScroll addSubview:i1];
    
    i12=[[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth-168/2, 0, 168/2, 220*ScreenHeight/1334)];
    i12.backgroundColor=[UIColor colorWithRed:78/255.0 green:112/255.0 blue:22/255.0 alpha:1.0];
    [i12 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    i12.titleLabel.font=[UIFont systemFontOfSize:contenfot];
    [i12 addTarget:self action:@selector(anzhuangqueren:) forControlEvents:UIControlEventTouchUpInside];
    [i12 setTitle:@"售后确认" forState:UIControlStateNormal];
    [MYmainScroll addSubview:i12];

    if ([commdity.payStatuss isEqualToString:@"Y"]) {
        [i1 setTitleColor:[UIColor colorWithRed:255.00/255.0 green:255.00/255.0 blue:255.00/255.0 alpha:0.28] forState:UIControlStateNormal];
        [i12 setTitleColor:[UIColor colorWithRed:255.00/255.0 green:255.00/255.0 blue:255.00/255.0 alpha:0.28] forState:UIControlStateNormal];

            }else{
        
        if ([commdity.serviceStatuss isEqualToString:@"C"]) {
            [i12 setTitleColor:[UIColor colorWithRed:255.00/255.0 green:255.00/255.0 blue:255.00/255.0 alpha:0.28] forState:UIControlStateNormal];
        }

        
    }

    }else{
    
     saveAccount=NO;
    }
}

-(void)bushouyin:(UIButton*)sender{
    [i12 removeFromSuperview];
   
    [i1 removeFromSuperview];
    saveAccount=NO;
    
    if ([commdity.serviceStatuss isEqualToString:@"C"]) {
        
        
        if ([commdity.payStatuss isEqualToString:@"Y"]) {
            [self showAlertMessage:@"此订单已经收银！"];
            
            
        }else{
            
            commdity.sat=@"fuwubushouyin";
            
            ToResiduePayViewController  *generateVC=[[ToResiduePayViewController alloc] init];
            [self.navigationController pushViewController:generateVC animated:YES];
            
        }
        
    }else{
        
        
        [self showAlertMessage:@"此订单服务未确认！请先确认"];
        
    }
    
}


-(void)anzhuangqueren:(UIButton*)sender{
    [i12 removeFromSuperview];
    [i1 removeFromSuperview];
    saveAccount=NO;
    NSLog(@"%@",commdity.installStatus);
    
    
    
    
    if ([commdity.serviceStatuss isEqualToString:@"C"]) {
        [self showAlertMessage:@"此服务已经确认！"];
    }
    
    if ([commdity.serviceStatuss isEqualToString:@"R"]) {
        
        
        ServiceConfirmViewController  *generateVC=[[ServiceConfirmViewController alloc] init];
        [self.navigationController pushViewController:generateVC animated:YES];
    }
    if ([commdity.serviceStatuss isEqualToString:@"A"]) {
        
        
        ServiceConfirmViewController  *generateVC=[[ServiceConfirmViewController alloc] init];
        [self.navigationController pushViewController:generateVC animated:YES];
    }
    
}



-(void)zhankai:(UIButton*)sender
{
    
        [zhangkai removeFromSuperview];
    if (arrrss.count>0) {
        view4.frame=CGRectMake(0, shangpingView.bottom+10, ScreenWidth, 180);
        
    }else{
        view4.frame=CGRectMake(0, view3.bottom+10, ScreenWidth, 180);
        
    }

        diview.frame=CGRectMake(0, view4.bottom+10, ScreenWidth, 100);
       
        if ([commdity.serviceStatuss isEqualToString:@"C"]) {
            
        zuixiaview.frame=CGRectMake(0, diview.bottom, ScreenWidth, 150);
        }else{
        
        zuixiaview.frame=CGRectMake(0, view4.bottom, ScreenWidth, 150);
        }
        
        
        [MYmainScroll setContentSize:CGSizeMake(ScreenWidth, zuixiaview.bottom+50)];
        
        
}

-(void)zhankai1:(UIButton*)sender
{
    [zhangkai1 removeFromSuperview];
    diview.frame=CGRectMake(0, view4.bottom+10, ScreenWidth, 180);
    zuixiaview.frame=CGRectMake(0, diview.bottom, ScreenWidth, 150);
    [MYmainScroll setContentSize:CGSizeMake(ScreenWidth, zuixiaview.bottom+50)];

}
-(void)closeKeyBoad
{
    
    [i12 removeFromSuperview];
    [i1 removeFromSuperview];
    saveAccount=NO;
}
- (void)showAlertWait
{
    alt = [[UIAlertView alloc] initWithTitle:@"网络不稳定 ！" message:@"请确认网络" delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
    
}

- (void)showAlertMessage:(NSString *)msg
{
    alt = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:msg delegate:nil cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
}
- (void)hideAlert
{
    if (alt != nil)
    {
        [alt dismissWithClickedButtonIndex:0 animated:YES];
        alt = nil;
    }
}

@end
